package ${cfg.package_dir}.common;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
public enum ReStat{
    FAIL_ER_SERVER(-1,"服务器错误"),
    FAIL_USER_EXSIST(-2,"用户已经存在"),
    FAIL_UNKNOWN_USER(-3,"用户不存在,请注册"),
    FAIL_PWD_ERROR(-4,"密码错误"),
    FAIL_LOCKED_ACCOUNT(-5,"账户锁定"),
    FAIL_401(-6,"当前资源需要登录"),
    FAIL_TOKEN_EXP(-7,"身份认证过期,请尝试重新登录"),
    FAIL_TOKEN_ERRO(-8,"身份凭证错误"),
    FAIL_ROLES_403(-9,"当前资源需要角色权限"),

    SUC_OK(0,"成功执行"),
    SUC_LOGIN(2,"成功登录"),
    SUC_REGISTER(1,"成功注册");


    private int code ;
    private  String msg;
    private ReStat(int c, String s){
        this.code=c;
        this. msg=s;
    }
    public JSONObject getJSON(){
    JSONObject json = JSONUtil.createObj();
        json.set("code",this.code).set("信息描述",this. msg);
        return json;
    }
    public int getCode() {return code; }
    public String getMsg() { return  msg; }
}
